<?php
$this->pageTitle=Yii::app()->name . ' - Giải bài tập';
$this->breadcrumbs = array(
	
);
?>
<div class="well">
	<div class="navbar">
		<div class="navbar-inner"><i class="icon-chevron-right"></i> Giải bài tập</div>
	</div>
	<div class="row-fluid">
		<?php
    	if(Yii::app()->user->hasFlash('success')) {
    		echo '<div class="alert alert-success">'.Yii::app()->user->getFlash('success').'</div>';
    	} 
    ?>
		 <?php
    $form=$this->beginWidget('CActiveForm', array(
    'id'=>'issue-submit-form',
    'enableAjaxValidation'=>true,
    'htmlOptions'=>array('class'=>'form-horizontal','enctype' => 'multipart/form-data'),
  )); 
    ?>
			<p class="note">Những trường đánh dấu <span class="required">*</span> là trường bắt buộc.</p>
			<?php echo $form->errorSummary(array($model),"","",array('class'=>'alert alert-error')); ?>
	    <div class="control-group">
	    	<?php echo $form->labelEx($model,'gradeID',array('class'=>'control-label')); ?>
		    <?php echo $form-> dropdownList($model,'gradeID',$model->getGrade(),array('prompt'=>'Chọn lớp','required'=>'required'))?>
	   	</div>
	  
	    <div class="control-group">
	    	<?php echo $form->labelEx($model,'subjectID',array('class'=>'control-label')); ?>
		    <?php echo $form-> dropdownList($model,'subjectID',$model->getSubject(),array('prompt'=>'Chọn môn học','required'=>'required'))?>
      </div>
	    
      <div class="control-group">
      	<?php echo $form->labelEx($model,'quantity_object',array('class'=>'control-label')); ?>
		    <?php echo $form->textField($model,'quantity_object',array('required'=>'required')); ?>
	   	</div>
	   	
	   	<div class="control-group">
      	<?php echo $form->labelEx($model,'content',array('class'=>'control-label')); ?>
		    <?php echo $form->textField($model,'content',array('required'=>'required')); ?>
	   	</div>
	  	
	  	<div class="control-group">
	  		<?php echo $form->labelEx($model,'image',array('class'=>'control-label')); ?>
	  		<?php $this->widget('CMultiFileUpload', array(
  								'model'=>$model,// dong nay lam gi>
  								'max'=>5,// gioi han so luong file?
                  'name' => 'Issue[image]',
                  'accept' => 'jpeg|gif|png|jpg', // useful for verifying files
                  'duplicate' => 'File bị trùng, vui lòng chọn lại!', // useful, i think
                  'denied' => 'File không hợp lệ', // useful, i think
              ));
      ?>   
  		</div>
	
	  	<?php if(CCaptcha::checkRequirements()) { ?>
      <div class="control-group clearfix">
        <?php echo $form->labelEx($model,'captcha',array('class'=>'control-label')); ?>
        <div class="captcha">
        <?php $this->widget('CCaptcha', array(
            'buttonLabel'=>'<i class="icon-refresh"></i>',
            'clickableImage'=>true,
        		'imageOptions'=>array('id'=>'img_captcha')
        )); ?>
        <?php echo $form->textField($model,'captcha', array('autocomplete'=>'off','required'=>'required')); ?>
        </div>
        <div class="hint">
        	Vui lòng nhập những ký tự ở hình bên trên. <br>
        	Không phân biệt chữ hoa chữ thường.
        </div>
      </div>
      <?php } ?>
			<?php echo CHtml::submitButton('Gửi issue', array('class'=>'btn btn-success')); ?>
		<?php $this->endWidget(); ?>
	</div>
</div>
<script type="text/javascript">
$(function() {
	$(window).load(function(){
		$("#img_captcha").trigger("click");
	});
});
</script>
